<extend name="Public:bg_theme" />
<block name="content">
    <!-- bootstrap -->
    <script type="text/javascript" src="__PUBLIC__/js/bootstrap/js/bootstrap.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/bootstrap/css/bootstrap.css">
    <!-- x-editable -->
    <script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable-1.4.5/bootstrap-editable/js/bootstrap-editable.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/bootstrap-editable-1.4.5/bootstrap-editable/css/bootstrap-editable.css">
    <div class="location">
        <i>当前位置：</i>
        <gt name="_GET.pid" value="1">
        <a href="{:U('index?pid='.$current_parent['pid'])}" class="nav_a">返回上级</a>
        <else />
        <a href="javascript:;" class="nav_a">文章</a>
        </gt>
    </div>
    <div class="title_form">
        <div class="title_search">
            <form action="{:U('')}" method="post">
                <label for="">中文名：</label>
                <input type="text" name="title" class="title_text input_style input_focus" value="{:I('title')}">
                <button class="find_btn" type="submit">搜索</button>
            </form>
        </div>
        <a href="{:U('add')}"><button class="find_btn add_btn fl">新增</button></a>
        <button class="find_btn add_btn fr" id="sortButton" data-operate="__URL__/sort/value/Article-">排序</button>
    </div>
    <div class="content_table">
        <form action="{:U('delete')}" method="post" id="del_form">
            <table id="del_table" class="data-table">
                <tr>
                    <th><input type="checkbox" name="checkAll"></th>
                    <th>中文名</th>
                    <th>英文名</th>
                    <th>类型</th>
                    <th>描述</th>
                    <th>自定义url</th>
                    <th>状态</th>
                    <th>排序</th>
                    <th>创建时间</th>
                    <th>更新时间</th>
                </tr>
                <volist name="list" id="vo">
                    <tr>
                        <td>
                            <input type="checkbox" name="id[]" value="{$vo.id}" id="checkEach">
                        </td>
                        <td>
                            <a href="javascript:;" class="editable" data-name="title" data-type="text" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}">{$vo.title}</a>
                            <a href="{:U('edit',array('id'=>$vo['id']))}">编辑</a>
                        </td>
                        <td>
                            <a href="javascript:;" class="editable" data-name="name" data-type="text" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}" data-value="{$vo.name}">{$vo.name|wb_substr="5"}</a>
                        </td>
                        <td>
                            <a href="javascript:;" class="editable group" data-name="cate_id" data-type="select" data-pk="{$vo.id}" data-source="{:U('editbleGetCate')}" sourceError="获取分类失败" data-url="{:U('ajaxUpdate')}" data-value="{$vo.cate_id}">{$vo.cate_title}</a>
                        </td>
                        <td>
                            <a href="javascript:;" class="editable" data-name="desc" data-type="textarea" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}" data-value="{$vo.desc}">{$vo.description|wb_substr="15"}</a>
                        </td>
                        <td>
                            <a href="javascript:;" class="editable" data-name="link" data-type="text" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}" data-value="{$vo.link_id}"><empty name="vo.link_id">无<else />有</empty></a>
                        </td>
                        <td>
                            <a href="javascript:;" class="editable status" data-name="visible" data-type="select" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}" data-source="[{value: 0, text: '禁用'},{value: 1, text: '启用'}]" data-value="{$vo.status}"></a>
                        </td>
                        <td>
                            <a href="javascript:;" class="editable" data-name="sort" data-type="text" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}">{$vo.sort}</a>
                        </td>
                        <td>
                            <span title="{$vo.ctime|date="Y-m-d h:i:s",###}">{$vo.create_time|date="y/m/d h:i",###}</span>
                        </td>
                        <td>
                            <present name="vo.update_time">
                                <span title="{$vo.update_time|date="Y-m-d h:i:s",###}">{$vo.update_time|date="y/m/d h:i",###}</span>
                            </present>
                        </td>
                    </tr>
                </volist>
            </table>
         </form>
    </div>

    <div class="content_btn">
        <button class="find_btn" id="batch_del">删除</button>
    </div>
<script type="text/javascript">
    $(function() {
        //全选
        $("input[name='checkAll']").click(function() {
            $("input#checkEach").attr("checked", this.checked);
        })
        //初始化editable
        $('.editable').editable({
            emptytext: '空',
            success: function(response, newValue) {
                if (!response.status) {
                    return response.info;
                } else {
                    location.reload(true);
                }
            }
        });

        //批量删除
        <include file= "Public:batch_delete" />
    })
</script>
</block>
<block name="foot_js">
    $(function(){
    //左侧导航子页面高亮选中
    highlight_sidebar('{:U('index')}');
    });
</block>
